/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pv1682010;

import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.sql.DataSource;

/**
 *
 * @author Petr
 */
public class Database implements DataSource {

    //private static final String URL = "jdbc:mysql://db.fi.muni.cz/dbxkunc7?user=xkunc7&password=javaproject";
    //private static final String URL = "jdbc:mysql://localhost/java?user=root&password=8i5646";
    private static final String URL = "jdbc:mysql://localhost/pv168?user=xstefan5&password=totojetajneheslo";

    public Connection getConnection() throws SQLException {
        return DriverManager.getConnection(URL);
    }

    public Connection getConnection(String username, String password) throws SQLException {
        return DriverManager.getConnection("jdbc:mysql://localhost/java?user="+username+"&password="+password);
    }

    public PrintWriter getLogWriter() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setLogWriter(PrintWriter out) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void setLoginTimeout(int seconds) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public int getLoginTimeout() throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public <T> T unwrap(Class<T> iface) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public boolean isWrapperFor(Class<?> iface) throws SQLException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
